type Sub = { update: Function };

export class Dep {
  private readonly subs: Sub[];
  static target: any;
  constructor() {
    this.subs = [];
  }
  addSub(obj: Sub) {
    if (obj && obj.update) {
      this.subs.push(obj);
    }
  }
  notify() {
    this.subs.forEach((sub) => sub.update());
  }
}
